let obj = {
	a: {
		c: [1, 2]
	},
	b: 1
}
obj.a.c.d = obj
console.log(obj);

function circleDetector(obj) {
	let res = [obj] //先存一份

	function circle(o) {
		for (let key in o) {
			if (typeof o[key] === 'object' && typeof obj[key] !== null) {
				if (res.indexOf(o[key] >= 0)) { //有存在
					return true
				}
				res.push(o[key])
				return circle(o[key])
			}
		}
	}
	return circle(obj)
}
console.log(circleDetector(obj));

// 判断两个对象是否相等
// Object.is({
// 	name: "cat"
// }, {
// 	name: "cat"
// })//false

let res = [{
	name: 'cat'
}, {
	age: 19
}]
let o = {
	name: 'cat'
}
res.indexOf(o)
